﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xant.FlowEngine.Interface;

namespace Xant.FlowEngine.Core
{
    public abstract class AbstractActor : IActor
    {
        /// <summary>
        /// 显示文本
        /// </summary>
        public abstract string Text { get; }

        /// <summary>
        /// 输出XML文本
        /// </summary>
        /// <returns></returns>
        public abstract string ToXml();

        /// <summary>
        /// 获得此参与者类实际参与工作项的职员枚举
        /// <remarks>例如指定部门岗位所对应的人，某个组的成员，或是特定的某个用户。具体解析由派生类实现</remarks>
        /// </summary>
        /// <returns></returns>
        public abstract IEnumerable<IStaffMember> GetStaffs();

        /// <summary>
        /// 参与者类型
        /// <remarks>部门、岗位、组、职员等具体的参与者类的类型标志</remarks>
        /// </summary>
        protected virtual string Type
        {
            get
            {
                const string suffix = "Actor";
                string typeName = this.GetType().Name;
                if (typeName.EndsWith(suffix))
                    typeName = typeName.Remove(typeName.Length - suffix.Length);
                return typeName;
            }
        }

        protected string delimitation;
    }

}
